<template>
  <div>
    <el-button size="mini" type="primary" icon="el-icon-edit" @click="to"/>
    <eForm ref="form" :sup_this="sup_this" :is-add="false"/>
  </div>
</template>
<script>
import eForm from './form'
export default {
  components: { eForm },
  props: {
    data: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      required: true
    }
  },
  methods: {
    to() {
      const _this = this.$refs.form
      _this.getEqptStates()
      _this.getEqptSystem()
      _this.getEqptBrand()
      _this.getEqptModelname()
      _this.form = {
        id: this.data.id,
        eqptsystem: this.data.eqptsystem,
        eqpttypeid: this.data.eqpttypeid,
        eqptcode: this.data.eqptcode,
        eqptname: this.data.eqptname,
        brandname: this.data.brandname,
        modelname: this.data.modelname,
        serialno: this.data.serialno,
        location: this.data.location,
        header: this.data.header,
        headerphone: this.data.headerphone,
        manufacturer: this.data.manufacturer,
        purtime: new Date(this.data.purtime),
        supplier: this.data.supplier,
        suppliercontact: this.data.suppliercontact,
        suppliercontactphone: this.data.suppliercontactphone,
        warrantytime: this.data.warrantytime,
        eqptdesc: this.data.eqptdesc,
        eqptstate: this.data.eqptstate
      }
      _this.getEqptType(this.data.eqptsystem)
      _this.getAllAttatchment(this.data.eqptcode)
      // console.log(this.data)
      _this.dialog = true
    }
  }
}
</script>

<style scoped>
  div{
    display: inline-block;
    margin-right: 3px;
  }
</style>
